﻿using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Brilliant_see.Core.Interfaces;
using Brilliant_see.Core.structs;

namespace Brilliant_see.Core.AbstractClass;

/// <summary>
/// 漫画抽象类，规范漫画实体属性
/// </summary>
public abstract class Comic : INotifyPropertyChanged
{
    /// <summary>
    /// 是否反转列表
    /// </summary>
    public abstract bool IsReverseList { get; set; }

    /// <summary>
    /// 已读章节索引
    /// </summary>
    public abstract int ReadChapterIndex { get; set; }

    /// <summary>
    /// 漫画名
    /// </summary>
    public abstract string Name { get; set; }

    /// <summary>
    /// 作者
    /// </summary>
    public abstract string Witer { get; set; }

    /// <summary>
    /// 漫画源
    /// </summary>
    public abstract IMapSource ComicSource { get; init; }

    /// <summary>
    /// 漫画url
    /// </summary>
    public abstract string ComicUrl { get; set; }

    /// <summary>
    /// 封面
    /// </summary>
    public abstract string Cover { get; set; }

    /// <summary>
    /// 最新信息
    /// </summary>
    public abstract string LateInfo { get; set; }

    /// <summary>
    /// 简介
    /// </summary>
    public abstract string? Blurb { get; set; }

    /// <summary>
    /// 章节列表
    /// </summary>
    public abstract Chapter[]? Chapters { get; set; }

    public event PropertyChangedEventHandler? PropertyChanged;

    /// <summary>
    /// 加载延时数据
    /// </summary>
    /// <returns></returns>
    public abstract Task LoadDelayDataAsync();

    /// <summary>
    /// 更新章节列表
    /// </summary>
    /// <returns></returns>
    public abstract Task UpdateChaptersAsync();

    /// <summary>
    /// 反转章节列表
    /// </summary>
    /// <returns></returns>
    public abstract Task ReverseChaptersAsync();

    protected void OnPropertyChanged([CallerMemberName] string? name = null)
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
    }
}